#ifndef PLANARREFRACTOR_H
#define PLANARREFRACTOR_H


#include "Refractor.h"

#include <vector>
using std::vector;


class PlanarRefractor : public Refractor
{

	public:
		PlanarRefractor();
		virtual ~PlanarRefractor();

		void startRefractionDraw(const Camera& camera, vector<Light*>& lights);
		void endRefractionDraw(vector<Light*>& lights);
		void init(const char* filename, ID3D11Device* g_device, ID3D11DeviceContext* g_context);
		virtual void drawRefraction(const Mesh* mesh);
		
		void setWidth(int w) { width = w; }
		void setHeight(int h) { height = h; }

		int getWidth() const { return width; }
		int getHeight() const { return height; }

		void Update(float dt) {}
		void draw(const Camera& camera, const vector<Light*>& lights) {}

		void setRefractorHeight(float v) { mRefractor_height = v; }
		float getRefractorHeight() const { return mRefractor_height; }

	private:
		ID3D11RenderTargetView* rtv;
		ID3D11DepthStencilView* dsv;

		int width;
		int height;
		
		float mRefractor_height;

		XMFLOAT4X4 m_ViewProj;

		XMFLOAT4X4 m_refract;
		ID3DX11EffectMatrixVariable*	fx_m_WorldRefractViewProj;
		ID3DX11EffectMatrixVariable*	fx_m_WorldRefract;
		ID3DX11EffectScalarVariable*	fx_refractor_height;


		ID3DX11EffectShaderResourceVariable*	fx_tex_shadow_map;
		ID3DX11EffectVariable*					fx_lights;
		ID3DX11EffectScalarVariable*			fx_num_lights;
		ID3DX11EffectVectorVariable*			fx_pEye;
		ID3DX11EffectScalarVariable*			fx_bShadowed;
		ID3DX11EffectScalarVariable*			fx_bUsePCSS;

		std::vector<XMFLOAT4> l_pos;
		std::vector<XMFLOAT4> l_dir;
};




#endif